/**
  ******************************************************************************
  * @file   :   .c
  * @version:
  * @author :
  * @brief  :
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright(c) . BLUEX Microelectronics.
  * All rights reserved.</center></h2>
  *
  *
  ******************************************************************************
  */

/* includes ------------------------------------------------------------------*/

#include "bx_pm.h"
#include "bx_kernel.h"

/* private define ------------------------------------------------------------*/

/* private typedef -----------------------------------------------------------*/

/* private variables ---------------------------------------------------------*/
static u32 pm_state;
static s32 pm_service_id;
/* exported variables --------------------------------------------------------*/


/*============================= private function =============================*/

///** ---------------------------------------------------------------------------
// * @brief   :
// * @note    :
// * @param   :
// * @retval  :
//-----------------------------------------------------------------------------*/
//bool bxs_pm_init( void )
//{
//    bx_pm_init();
//    pm_service_id = bx_register(bxs_pm_msg_handle,"power manager service");
//    if( pm_service_id == -1 )
//        return false;
//    return true;
//}
///** ---------------------------------------------------------------------------
// * @brief   :
// * @note    :
// * @param   :
// * @retval  :
//-----------------------------------------------------------------------------*/
//s32 bxs_pm_id( void )
//{
//    return pm_service_id;
//}
///** ---------------------------------------------------------------------------
// * @brief   :
// * @note    :
// * @param   :
// * @retval  :
//-----------------------------------------------------------------------------*/
//bx_err_t bxs_pm_msg_handle(u32 msg, u32 param0, u32 param1)
//{
//    switch( msg ){
//        case BX_PM_MSG_LOCK:
//            bx_pm_lock(param0);
//            break;
//        
//        case BX_PM_MSG_UNLOCK:
//            bx_pm_unlock(param1);
//            break;
//        
//        default:
//            break;
//    }
//    return BX_OK;
//}
/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
void bx_pm_init( void )
{
    pm_state = 0;
}
/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
void bx_pm_lock( u32 flag )
{
    pm_state |= flag;
}
/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
void bx_pm_unlock( u32 flag )
{
    pm_state &= ~flag;
}
/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
bool bx_pm_check( u32 flag )
{
    return ( pm_state & flag ) > 0;
}
/*========================= end of exported function =========================*/


/*============================= import function ==============================*/

/*=========================== end of import function =========================*/


/*============================ interrupt function ============================*/

/*========================= end of interrupt function ========================*/


/******************** (C) COPYRIGHT BLUEX **********************END OF FILE****/



